function get_qikan(leibie) {
  $.getJSON('wenjuan_get.php', {
      leibie: leibie
    },
    function(data) {
      $('#QiKanList').empty();
      for (let i = 0; i < data.length; i++) {
        $('#QiKanList').append('<div class="radio"> <label> <input name="qikan" type="checkbox" class="colored-blue" value="' + data[i].id + '"><span class="text">' + data[i].name + '</span> </label> </div>');
      }
    }
  );
}
$('input[name=leibie]').change(function() {
  get_qikan($('input[name=leibie]:checked').val())
})
$('#Refer').click(function() {
  if (!$('input[name=leibie]:checked').val()) {
    alert('请选择读者类型！')
    return;
  }
  var qikan_array = [];
  $('input[name=qikan]:checked').each(function() {
    qikan_array.push($(this).val())
  })
  $.post('wenjuan.php', {
      leibie: $('input[name=leibie]:checked').val(),
      qikan_array: qikan_array.toString()
    },
    function(data, textStatus, jqXHR) {
      alert('数据已提交！');
      window.location.href="wenjuan.html"
    }
  );
})
